<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        async function test() {
            console.log("test")
            return new Promise((resolve, reject) => {
                //resolve("suc-111")
                reject("err-222")
            })
        }
        //console.log(test()) //primise
        let res = test()
        res.then(res => {
            console.log("success", res)
        }).catch(err => {
            console.log("err", err)
        })
        /*小结：
            1. async返回值是非promise对象，状态为fulfilled，则进入then
            2. async返回值是promise对象，状态为fulfilled 或 reject，则进入then 或 catch
        */
    </script>
</body>

</html>